<?php

namespace admin\models;

use Yii;

/**
 * This is the model class for table "mm_user_ill".
 *
 * @property integer $mi_id
 * @property integer $mu_id
 * @property string $mi_type
 * @property string $mi_cure
 *
 * @property Info $mu
 */
class UserIll extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'mm_user_ill';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['mi_type','mi_cure'],'required'],
            [['mu_id'], 'integer'],
            [['mi_cure'], 'string'],
            [['mi_type'], 'string', 'max' => 128],
            [['mu_id'], 'exist', 'skipOnError' => true, 'targetClass' => UserInfo::className(), 'targetAttribute' => ['mu_id' => 'mi_id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'mi_id' => '病史id',
            'mu_id' => '用户id',
            'mi_type' => '病种类型',
            'mi_cure' => '是否已痊愈',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getMu()
    {
        return $this->hasOne(UserInfo::className(), ['mi_id' => 'mu_id']);
    }
}
